package cn.shop.core.service.impl;

import cn.shop.core.bean.GoodsInfo;
import cn.shop.core.dao.GoodsDAO;
import cn.shop.core.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2016/8/26.
 */
@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    private GoodsDAO goodsDAO;
    public void add(GoodsInfo goods) {
        goodsDAO.add(goods);
    }

    @Transactional(readOnly = true)
    public List<Map> getGoodsList(GoodsInfo goods) {

        return goodsDAO.getList(goods);
    }

    public Long getGoodsCount(GoodsInfo goods) {
        return goodsDAO.getCount(goods);
    }

    public Map getGoods(GoodsInfo goods) {
        return goodsDAO.getGoods(goods);
    }

    public void updateGoods(GoodsInfo goods) {
        goodsDAO.update(goods);
    }

    public void deleteGoods(GoodsInfo goods) {
        goodsDAO.delete(goods);
    }
}
